package com.shun.common.log.event;

import com.shun.base.api.ShunBaseApi;
import com.shun.base.dto.SysOperLogDto;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Async;

@Slf4j
@AllArgsConstructor
public class ShunLogListener {

	private final ShunBaseApi baseApi;
	
	@Async
	@Order
	@EventListener(com.shun.common.log.event.ShunLogEvent.class)
	public void addWbsLog(ShunLogEvent event) {
		SysOperLogDto opLog = (SysOperLogDto) event.getSource();
		log.debug("返回结果：{}",baseApi.addSysOperLog(opLog));
	}
}
